<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			//作业一
			// var arr = [-2, 5, -3, 8];
			// var sum = 0;
			// for (var i of arr){
			// 	sum += Math.abs(i);
			// }
			// console.log(sum);
			
			//作业二
			var arr = [3.2, 4.7, 2.1, 5.9,3];
			var sum = arr.reduce((accu,curr) => accu + Math.round(curr),0);
			const average = sum / arr.length;//平均值
			const result = average.toFixed(2);//保留两位小数
			console.log(result);
			
		</script>
	</body>
</html>